/**
 * FileName:         TpNoticeController.java
 * @Description:     TODO
 * @author:            zl
 * @version            V1.0
 * Createdate:      2019年1月10日     下午4:30:17
 * Copyright:       
 * Company           CY.
 * All rights Reserved, Designed By crane-yuan

 * Modification  History:
 * Date         Author        Version        Discription
 * ---------------------------------------------------------------------------
 * 2019年1月10日     crane-yuan       1.0             1.0

 * Why & What is modified:

 */
package com.Brewing.springboot.controller.TpNotice;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.Brewing.springboot.common.BrewingJSONResult;
import com.Brewing.springboot.common.PagedResult;
import com.Brewing.springboot.controller.BasicController;
import com.Brewing.springboot.service.TpNotice.NoticeService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Company: </p>
 * @author  庄磊
 * @date	2019年1月10日 下午4:30:17 
 * @version 1.0
 */
@RestController
@Api(value="Notice-Api",tags= {"Notice-Api"})
@RequestMapping("/notice")
public class TpNoticeController extends BasicController{
	
	@Autowired
	private NoticeService noticeService;
	
	@ApiOperation(value="用户通知", notes="用户通知的接口")
	@ApiImplicitParam(name="userId", value="用户id", required=true, dataType="String", paramType="query")
	@PostMapping("/getNotice")
	public BrewingJSONResult getNotice(String userId,@RequestParam(defaultValue = "1") Integer page) {
		if(StringUtils.isBlank(userId)) {
			return BrewingJSONResult.errorMsg("用户id不能为空...");
		}
		PagedResult result = noticeService.getNotice(userId,page,PAGE_SIZE);
		return BrewingJSONResult.ok(result);
	}
}
